"""
#第一题
import random
a=random.randint(1,100)
b=int(input("猜测数字为"))
while b!=a:
    if b>a:
        print("大了")
    else:
        print("小了")
    b=int(input("猜测数字为"))
else:
    print("恭喜猜中，本轮幸运数字：",a)"""

"""#第二题
import random
a=random.randint(1,100)
print(a)
money=5000
b=int(input("猜测数字为"))
while money>=500:
    while b!=a:
        if b>a:
            print("大了")
        else:
            print("小了")
        money-=500
        print("您的余额为：", money)
        if money>=500:
            b = int(input("猜测数字为"))
            continue
        else:
            break
    else:
        print("恭喜猜中，本轮幸运数字：",a)
        money+=3000
        print("您的余额为：", money)
        break
else:
    print("余额不足，游戏退出")"""


#第三题
import random
a=random.randint(1,100)
money=5000
b=int(input("猜测数字为"))
while money>=500:
    while b!=a:
        if b>a:
            print("大了")
        else:
            print("小了")
        money-=500
        print("您的余额为：", money)
        if money>=500:
            b = int(input("猜测数字为"))
            continue
        else:
            break
    else:
        print("恭喜猜中，本轮幸运数字：",a)
        money+=3000
        print("您的余额为：",money)
        c=input("是否要进行下一轮：yes/no")
        if c=='yes':
            a = random.randint(1, 100)
            b = int(input("猜测数字为"))
            continue
        else:
            break
else:
    print("余额不足，游戏退出")







